package com.shigen.file.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.shigen.file.serializer.DateTimeSerializer;
import com.shigen.file.serializer.FileSizeSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * <p>
 * 用户文件表
 * </p>
 *
 * @author shigen.fu
 * @since 2022-06-04
 */
@TableName("base_user_file")
@ApiModel(value = "BaseUserFile对象", description = "用户文件表")
@Data
@Accessors(chain = true)
public class BaseUserFile implements Serializable {

  private static final long serialVersionUID = 1L;

  @ApiModelProperty("自增的id")
  @TableId(value = "id", type = IdType.AUTO)
  private Long id;

  @ApiModelProperty("文件的唯一标识")
  private String unionId;

  @ApiModelProperty("父文件夹")
  private String parentId;

  @ApiModelProperty("上传用户id")
  private Long uploadUserId;

  @ApiModelProperty("文件名")
  private String name;

  @ApiModelProperty("文件大小")
  @JsonSerialize(using = FileSizeSerializer.class)
  private Long size;

  @ApiModelProperty("上传用户名")
  private String uploadUserName;

  @ApiModelProperty("文件类型-后缀")
  private String type;

  @ApiModelProperty("文件存储地址")
  private String url;

  @ApiModelProperty("文件备注")
  private String note;

  @ApiModelProperty("是否删除")
  private Integer isDel;

  @ApiModelProperty("是否所有人可见")
  private Integer isPublic;

  @ApiModelProperty("创建时间")
  @JsonSerialize(using = DateTimeSerializer.class)
  private Date createTime;

  @ApiModelProperty("更新时间")
  @JsonSerialize(using = DateTimeSerializer.class)
  private Date updateTime;

  @ApiModelProperty(value = "文件夹下的子文件")
  @TableField(exist = false)
  private List<BaseUserFile> children;
}
